package com.beta.cms.controller.base;



import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 
  * @ClassName: BaseController
  * @author yangfei
  * @date 2016年7月29日 上午10:21:51
  *
 */
public class BaseController {

	protected final Logger logger = LoggerFactory.getLogger(this.getClass());
	// 默认每页显示条数
	protected static final Integer DEFUALT_ROWS = 10;
	// 默认显示第几页
	protected static final Integer DEFUALT_PAGE = 1;
	protected final String SUCCESS_CODE = "200";
	protected final String SUCCESS = "success";
	protected final String ERROR_CODE = "-200";
	protected Integer rows;// 每页显示的记录数
	protected Integer page;// 当前第几页
	protected Integer currentPage;
	public Integer getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(Integer currentPage) {
		this.currentPage = currentPage;
	}

	public Integer getRows() {
		if (this.rows == null) {
			this.rows = DEFUALT_ROWS;
		}
		return rows;
	}

	public void setRows(Integer rows) {
		this.rows = rows;
	}

	public Integer getPage() {
		if (this.page == null) {
			this.page = DEFUALT_PAGE;
		}
		return page;
	}
	public void setPage(Integer page) {
		this.page = page;
	}
	protected Integer getStartIndex() {
		return (this.getPage() - 1) * this.getRows();
	}	
}
